import React from 'react';
import { format } from '@/utils/datetime';
import CommonPage from '@/components/page/CommonPage';
const daoName = 'ShIndiPhjr';
const importName = 'ShIndiPhjr';

const columns: API.Column[] = [
  {
    title: '导入日期',
    width: 120,
    sorter: true,
    key: 'DRRQ',
    dataIndex: 'DRRQ',
    render: (data) => format(data, 'yyyy-MM-dd'),
    dispaly: true,
    filter: true,
    export: false,
  },
  {
    title: '借据编号',
    width: 200,
    sorter: true,
    dataIndex: 'JJH',
    key: 'JJH',
    dispaly: true,
    filter: true,
    export: true,
  },
  {
    title: '客户名称',
    width: 200,
    sorter: true,
    dataIndex: 'KHMC',
    key: 'KHMC',
    dispaly: true,
    filter: true,
    export: true,
  },
];
const controls: API.Control[] = [
  {
    name: 'DRRQ',
    rules: [{ required: true, message: '不能为空' }],
    type: 'date',
    dataType: 'date',
    label: '导入日期',
    grid: 12 / 24,
  },
  {
    name: 'JJH',
    rules: [{ required: true, message: '不能为空' }],
    type: 'text',
    label: '借据编号',
    grid: 12 / 24,
  },
  {
    name: 'KHMC',
    rules: [{ required: true, message: '不能为空' }],
    type: 'text',
    label: '客户名称',
    grid: 12 / 24,
  },
];

const ShIndiPhjrForm: React.FC = () => {
  return (
    <CommonPage
      daoName={daoName}
      columns={columns}
      controls={controls}
      title="个贷普惠"
      importName={importName}
      importControls={controls}
      importMode="DeleteAfterInsert"
      importParamNames={['DRRQ']}
      importTemplateName="个贷普惠导入"
      initSorter={{ FieldName: 'DRRQ', Direction: 'DESC' }}
    />
  );
};

export default ShIndiPhjrForm;
